package com.bea.ftd.common.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.bea.ftd.common.enums.DateFormatEnum;
import com.bea.ftd.common.intf.IGatewayEntity;
import com.bea.ftd.common.utils.DateUtil;

import lombok.Data;

@Data
@Entity
@Table(name = "ratelimite_info")
public class RatelimiteInfo implements IGatewayEntity {

	private static final long serialVersionUID = 1850946151700912164L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "api_id")
	private String apiId;

	@Column(name = "ratelimite_type")
	private String ratelimiteType;

	@Column(name = "ratelimite_size")
	private Long ratelimiteSize;

	@Column(name = "direct_transmit")
	private Long directTransmit;

	@Column(name = "is_activated")
	private Long isActivated;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time")
	private java.util.Date createTime;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time")
	private java.util.Date updateTime;

	public String getFormatCreateTime() {
		if (null == createTime) {
			return "";
		}
		return DateUtil.formatDate(createTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}

	public String getFormatUpdateTime() {
		if (null == updateTime) {
			return "";
		}
		return DateUtil.formatDate(updateTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}
}
